package com.fhz.mvvmshopjava.data;

import androidx.lifecycle.LiveData;

import com.fhz.mvvmshopjava.api.ServiceApi;
import com.fhz.mvvmshopjava.data.model.LoggedInUser;
import com.fhz.mvvmshopjava.utils.RetrofitManger;
import com.fhz.utilsfhz.ApiResponse;

import java.io.IOException;

import javax.inject.Inject;

/**
 * Class that handles authentication w/ login credentials and retrieves user information.
 */
public class LoginDataSource {

    @Inject
    public LoginDataSource() {
    }

    public LiveData<ApiResponse<LoggedInUser>> login(String username, String password) {
        return RetrofitManger.getInstance().getRetrofit().create(ServiceApi.class).login(username, password);
    }

    public void logout() {
        // TODO: revoke authentication
    }
}